﻿using System;

namespace com.binance.client
{
	using BinanceApiConstants = com.binance.client.constant.BinanceApiConstants;
	using BinanceApiException = com.binance.client.exception.BinanceApiException;

	/// <summary>
	/// The configuration for the request APIs
	/// </summary>
	public class RequestOptions
	{

		private string url = BinanceApiConstants.API_BASE_URL;

		public RequestOptions()
		{
		}

		public RequestOptions(RequestOptions option)
		{
			this.url = option.url;
		}

		/// <summary>
		/// Set the URL for request.
		/// </summary>
		/// <param name="url"> The URL name like "https://fapi.binance.com". </param>
		public virtual string Url
		{
			set
			{
				try
				{
					Uri u = new Uri(value);
					this.url = u.ToString();
				}
				catch (Exception e)
				{
					throw new BinanceApiException(BinanceApiException.INPUT_ERROR, "The URI is incorrect: " + e.Message);
				}
				this.url = value;
			}
			get
			{
				return url;
			}
		}

	}

}